<?php 
		session_start(); 
		include "function/libfunc.php";
 			if (!empty($_SESSION['username']) && !empty($_SESSION['password'])) { 
		  	$link="Edit Ongkos";
		  	include 'themes/head2.php';
			include 'themes/heading.php';
?>
                    <!-- Build page from here: -->
                    
                    <script type="text/javascript">
                    $(function() {
$(".btn").click(function() {
var id = $("#idongkos").val();
var kab = $("#kabupaten").val();
var prov = $("#provinsi").val();
var biaya = $("#biaya").val();
var dataString = '&idongkos='+ id + '&kabupaten=' + kab+ '&provinsi=' + prov + '&biaya=' + biaya ;

if(id=='' || kab=='' || prov==''|| biaya=='')
{
$('.success').fadeOut(200).hide();
$('.error').fadeOut(200).show();
}
else
{
$.ajax({
type: "POST",
url: "function/ubahongkos.php",
data: dataString,
success: function(){
$('.success').fadeIn(200).show();
$('.error').fadeOut(200).hide();
}
});
}
return false;
});
});

function goBack()
  {
  window.history.back()
  }
//tambah

                    </script>
                   
                    <div class="row-fluid">

                        <div class="span10">

                            <div class="box">

                                <div class="title">

                                    <h4>
                                        <span class="icon16 icomoon-icon-equalizer-2"></span>
                                        <span><?php echo $link; ?></span>
                                    </h4>
                                    
                                </div>
                                <div class="content">
                                   
                                    <form class="form-horizontal" action="#" method="post" enctype="multipart/form-data">
                                    <?php  
									$link = koneksi_db();
									$sql  = "SELECT * FROM `ongkos` WHERE idongkos=".$_GET['id'];
									$hasil  = mysql_query($sql,$link)  or exit("Error query : <b>".$sql."</b>.");
									$res = mysql_fetch_assoc($hasil);
										?>
                                    
                                    	<div class="form-row row-fluid"> 
                                            <div class="span12">
                                                <div class="row-fluid">
                                                    <label class="form-label span4">ID:</label>
                                                    <input name="idongkos" id="idongkos" class="span8" type="text" readonly="readonly" value="<?php echo $res['idongkos']; ?>"  />
                                                </div>
                                            </div> 
                                        </div>

                                        <div class="form-row row-fluid">
                                            <div class="span12">
                                                <div class="row-fluid">
                                                    <label class="form-label span4" for="focusedInput">Kabupaten</label>
                                                    <input name="kabupaten" class="span8 focused" id="kabupaten" type="text" value="<?php echo $res['kabupaten']; ?>" required />
                                                </div>
                                            </div>
                                        </div>
                                        
                                        <div class="form-row row-fluid">
                                            <div class="span12">
                                                <div class="row-fluid">
                                                    <label class="form-label span4" for="focusedInput">Provinsi</label>
                                                    <input name="provinsi" class="span8 focused" id="provinsi" type="text" value="<?php echo $res['provinsi']; ?>" required />
                                                </div>
                                            </div>
                                        </div>
                                        
                                        <div class="form-row row-fluid">
                                            <div class="span12">
                                                <div class="row-fluid">
                                                    <label class="form-label span4" for="focusedInput">Biaya</label>
                                                    <input name="biaya" class="span8 focused" id="biaya" type="text" value="<?php echo $res['biaya']; ?>" required />
                                                </div>
                                            </div>
                                        </div>
                                 
                                        
                                        
                                        <div class="form-actions">
                                           <button type="submit" class="btn" class="submit"> Simpan</button>
                                           <button type="button" class="btn" onclick="goBack()">Kembali</button><br />
                                           
                                           <span class="error" style="display:none; color:#FF0000 "> <b>Masih ada data yang kosong!</b></span>
											<span class="success" style="display:none; color:#0000FF"> <b>Data kategori berhasil di update <a href="ongkos.php">Lihat!</a></b></span>
										</div>
                                        
                                        </div>
                                                                                

                                    </form>
                                 
                                </div>

                            </div><!-- End .box -->

                        </div><!-- End .span6 -->
					
<?php
include 'themes/footer.php';
}else {
echo "<script language='javascript'>window.location = '../admin/'</script>";
}
?>